package com.atguigu.lease.web.api.controller;

import com.atguigu.lease.common.result.Result;
import com.atguigu.lease.web.api.dto.RoomInfoSearchDto;
import com.atguigu.lease.web.api.service.RoomInfoService;
import com.atguigu.lease.web.api.vo.RoomDetailVo;
import com.atguigu.lease.web.api.vo.RoomItemVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/app/room")
@Tag(name = "房间模块")
public class RoomInfoController {
    @Resource
    RoomInfoService roomInfoService;
    ///app/room/pageItem?current=1&size=10
    @Operation(summary = "条件分页查询房间列表")
    @GetMapping("pageItem")
    public Result<Page<RoomItemVo>> pageItem(RoomInfoSearchDto searchDto){
        return Result.ok(roomInfoService.getPageItem(searchDto));
    }

    @Operation(summary = "根据id查询房间详情")
    @GetMapping("getDetailById")
    public Result<RoomDetailVo> getDetailById(@RequestParam("id")Long id){


        return Result.ok(roomInfoService.getDetailById(id));
    }
}
